package com.shfl.task.pagehelper;

public class Pageable {

    private Integer pageNo = 1;

    private Integer pageSize = 10;

    private String orderBy;

    public Pageable() {
    }

    public Pageable(Integer pageNo, Integer pageSize) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }

    public Pageable(Integer pageNo, Integer pageSize, String orderBy) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.orderBy = orderBy;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public boolean isPageable() {
        if (this.pageNo != null && this.pageNo > 0
                && this.pageSize != null && this.pageSize > 0) {
            return true;
        }
        return false;
    }

    @Override
    public String toString() {
        return "Pageable{" +
                "pageNo=" + pageNo +
                ", pageSize=" + pageSize +
                ", orderBy='" + orderBy + '\'' +
                '}';
    }
}
